﻿using System;
using System.Data;
using System.Collections.Generic;
using Maticsoft.Common;
using ZG_member.Model;
namespace ZG_member.BLL
{
	/// <summary>
	/// memberInfo
	/// </summary>
	public partial class memberInfo
	{
		private readonly ZG_member.DAL.memberInfo dal=new ZG_member.DAL.memberInfo();
		public memberInfo()
		{}
		#region  Method

		/// <summary>
		/// 得到最大ID
		/// </summary>
		public int GetMaxId()
		{
			return dal.GetMaxId();
		}
        public ZG_member.Model.memberInfo GetModelFormemberCardId(string id)
        {

            return dal.GetModelFormemberCardId(id);
        }

        /// <summary>
        /// 根据会员卡号获取对象
        /// </summary>
        public ZG_member.Model.memberInfo GetModeCard(string strWhere)
        {
            return dal.GetModeCard(strWhere);
        }

        public string GetMaxmemberId()
        {
            return dal.GetMaxmemberId();
        }
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(string id,string name)
		{
			return dal.Exists(id,name);
		}
        public bool ExistsByphone(string id,string memberid)
        {
            return dal.Existsbyphone(id,memberid);
        }

		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int  Add(ZG_member.Model.memberInfo model)
		{
			return dal.Add(model);
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(ZG_member.Model.memberInfo model)
		{
			return dal.Update(model);
		}
        /// <summary>
        /// 更新多条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Update1(ZG_member.Model.memberInfo model)
        {
            return dal.Update1(model);
        }
        public bool Updatepoint(ZG_member.Model.memberInfo model) {
            return dal.Updatepoint(model);
        }
        public bool Update2(ZG_member.Model.memberInfo model)
        {
            return dal.Update2(model);
        }
        public bool Update3(string status,string memberId)
        {
            return dal.Update3(status, memberId);
        }
        public bool shifoushouxinUpdate(string shifoushouxin, string memberId)
        {
            return dal.shifoushouxinUpdate(shifoushouxin, memberId);
        }

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(int id)
		{
			
			return dal.Delete(id);
		}
		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool DeleteList(string idlist )
		{
			return dal.DeleteList(idlist );
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public ZG_member.Model.memberInfo GetModel(int id)
		{

            return dal.GetModel(id);
		}


        /// <summary>
        /// 根据会员卡号得到实体对象
        /// </summary>
        /// <param name="cardID"></param>
        /// <returns></returns>
        public ZG_member.Model.memberInfo GetUserIdMode(string cardID)
        {

            return dal.GetUserIdMode(cardID);
        }
        /// <summary>
        /// 根据会员编号得到实体对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ZG_member.Model.memberInfo GetModels(string cardID)
        {

            return dal.GetModels(cardID);
        }

        //修改会员窗体传值
        public ZG_member.Model.memberInfo GetModelss(int id)
        {

            return dal.GetModel(id);
        }

		/// <summary>
		/// 得到一个对象实体，从缓存中
		/// </summary>
		public ZG_member.Model.memberInfo GetModelByCache(int id)
		{
			
			string CacheKey = "memberInfoModel-" + id;
			object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
			if (objModel == null)
			{
				try
				{
					objModel = dal.GetModel(id);
					if (objModel != null)
					{
						int ModelCache = Maticsoft.Common.ConfigHelper.GetConfigInt("ModelCache");
						Maticsoft.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(ModelCache), TimeSpan.Zero);
					}
				}
				catch{}
			}
			return (ZG_member.Model.memberInfo)objModel;
		}


        public DataSet Mains(string Size,string Num,string strWhere,string shaixuan)
        {
            return dal.Mains(Size, Num, strWhere, shaixuan);
        }

        //public DataSet MainsCardType(string Size, string Num,string strWhere)
        //{
        //    return dal.MainsCardType(Size, Num,strWhere);
        //}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			return dal.GetList(strWhere);
		}
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			return dal.GetList(Top,strWhere,filedOrder);
		}

        public List<ZG_member.Model.memberInfo> GetGuaShi(string strWhere)
        {
            DataSet ds = dal.GetGuaShi(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
         //<summary>
         //获得数据列表
         //</summary>
        public List<ZG_member.Model.memberInfo> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
		/// <summary>
		/// 获得数据列表
		/// </summary>
        public List<ZG_member.Model.memberInfo> DataTableToList(DataTable dt)
        {
            return dal.DataTableToList(dt);
        }

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetAllList()
		{
			return GetList("");
		}



        /// <summary>
        /// 获得数据列表Sql
        /// </summary>
        public DataSet GetListSql(string strSql)
        {
            return dal.GetListSql(strSql);
        }

        public string Getheji(string top, string where)
        {
            return dal.Getheji(top, where);
        }

		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		//{
			//return dal.GetList(PageSize,PageIndex,strWhere);
		//}

		#endregion  Method
	}
}

